<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	  xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:include="common::common(title='基础数据')">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" ></meta>
</head>
<script type="text/javascript" th:src="@{/js/testcase/taskCase.js}"></script>
<body>
<div id="app">
  <el-container style="margin-top:10px;">
	<el-header>
	    	<el-form ref="form" :model="queryData" label-width="80px">
		    	<el-row :gutter="20">
				  <el-col :span="6">
				  		<el-form-item label="任务">
					  		<el-input v-model="queryData.taskName" clearable>
							</el-input>
						</el-form-item>
				  </el-col>
				  <el-col :span="6">
				  		<el-form-item label="用例标题">
					  		<el-input v-model="queryData.title" clearable>
							</el-input>
						</el-form-item>
				  </el-col>
				  <el-col :span="6">
						  <el-form-item label="用例状态" prop="caseId" 
					      		:label-width="dialogConfig.formLabelWidth">
					      		  <el-select v-model="queryData.status" clearable>
								    <el-option
								      v-for="item in caseStatus"
								      :key="item"
								      :label="item"
								      :value="item"
								      >
								    </el-option>
								  </el-select>
				      		</el-form-item>
				  </el-col>
				  <el-col :span="6">
				  	<el-button type="primary" icon="el-icon-search" @click="query">查询</el-button>
				  </el-col>
				</el-row>
	    	</el-form>
	    </el-header>
	    <el-main style="padding:5px;">
	    	<div style="margin:10px">
				<el-button type="primary" size="medium" icon="el-icon-plus" @click="addItem">增加</el-button>
				<span sec:authorize="hasAuthority('TASK_CASE_DELETE')"><el-button type="primary" size="medium" icon="el-icon-delete" @click="deleteItem">删除</el-button></span>
	    	</div>
	    	<div style="margin:10px;">
	    	  <el-table  
	    	    ref="taskCaseDatagrid" 
	    	    :data="datagrid"
			    tooltip-effect="dark"
			    style="width: 100%;"
			    max-height="300"
			    @row-click="datagridSelect"
			    border
			    highlight-current-row
			    >
			    <el-table-column type="index" width="30"></el-table-column>
				    <el-table-column prop="taskName" label="任务名" width="100" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="libraryName" label="用例库" width="100" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="moduleName" label="模块名" width="100" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="title" label="用例标题" width="100" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="type" label="用例类型" width="100" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="level" label="用例优先级" width="100" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="createByName" label="创建人" width="80" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="createDate" label="创建时间" width="150" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="modifiedByName" label="修改人" width="80" show-overflow-tooltip> </el-table-column>
				    <el-table-column prop="modifiedDate" label="修改时间"> </el-table-column>
			  </el-table>
			</div>
			<div style="margin:10px">
			    <el-pagination
			      :current-page="queryData.page"
			      :page-sizes="[10, 20, 40, 100]"
			      :page-size="queryData.rows"
			      layout="total, sizes, prev, pager, next, jumper"
			      :total="totalNum"
			      @size-change="handleSizeChange"
			      @current-change="handleCurrentChange"
			      @prev-click="handlePrevClick"
			      @next-click="handleNextClick">
			    </el-pagination>
			 </div>
	    </el-main>
	</el-container>
	<!-- dialog 开始 不需要【删除】 -->
	<el-dialog :visible.sync="dialogConfig.dialogFormVisible" :close-on-click-modal="false" :show-close="false">
		  <el-form :model="addData" ref="dialogForm" :rules="rules">
	      	<el-form-item label="任务名" prop="taskId" 
	      		:label-width="dialogConfig.formLabelWidth">
		      <task-select v-on:selected="selectTask"></task-select>
		    </el-form-item>
	      	<el-form-item label="用例" prop="caseId" 
	      		:label-width="dialogConfig.formLabelWidth">
		      <case-select v-on:selected="selectCase"></case-select>
		    </el-form-item>
		    <el-form-item label="用例状态" prop="caseId" 
	      		:label-width="dialogConfig.formLabelWidth">
	      		  <el-select v-model="addData.status" placeholder="请选择">
				    <el-option
				      v-for="item in caseStatus"
				      :key="item"
				      :label="item"
				      :value="item">
				    </el-option>
				  </el-select>
      		</el-form-item>
		  </el-form>
		  <div slot="footer" class="dialog-footer">
		    <el-button @click="closeDialog">取 消</el-button>
		    <el-button type="primary" @click="submitForm('dialogForm')">确 定</el-button>
		  </div>
	 </el-dialog>
	 <!-- 引入任务下拉选择框 -->
	 <div th:include="testcase/components/taskSelect"></div>
	 <!-- 引入用例库下拉选择框 -->
	 <div th:include="testcase/components/caseSelect"></div>
</div>

</body>
</html>